window: Some protection against nested set_focus() calls
authorStef Walter <stefw@redhat.com>
Fri, 16 Aug 2013 19:19:15 +0000 (21:19 +0200)
committerStef Walter <stefw@redhat.com>
Sat, 17 Aug 2013 07:55:27 +0000 (09:55 +0200)
Since set_focus() can triger events, have a check to make
sure state is still valid before firing is-focus signal.

https://bugzilla.gnome.org/show_bug.cgi?id=706152

gtk/gtkwindow.c

index df0ec26c11edf49f04c9c9ecedde3ba6e27a804d..e611a70b4d4b4db66d453b682ebc94a3d90c3f16 100644 (file)
@@ -7514,7 +7514,11 @@ gtk_window_real_set_focus (GtkWindow *window,
       if (priv->has_focus)
        do_focus_change (priv->focus_widget, TRUE);
 
-      g_object_notify (G_OBJECT (priv->focus_widget), "is-focus");
+      /* It's possible for do_focus_change() above to have callbacks
+       * that clear priv->focus_widget here.
+       */
+      if (priv->focus_widget)
+        g_object_notify (G_OBJECT (priv->focus_widget), "is-focus");
     }
 
   /* If the default widget changed, a redraw will have been queued